<?php
/**
 * Created by PhpStorm.
 * User: jack Wang
 * Date: 2021/10/15
 * Time: 17:02
 */

/**
 * Class Base_Controller
 * @property Users_model $users_model
 * @property CI_Input $input
 * @property CI_Lang $lang
 * @property CI_Loader $load
 * @property Article_model $article_model
 * @property Cate_model $cate_model
 * @property Admins_model $admins_model
 * @property Rotation_model $rotation_model
 * @property CI_Form_validation $form_validation
 * @property User_service $User_service
 * @property Users_model $Users_model
 * @property Logger_model $logger_model
 * @property Activity_model $Activity_model
 * @property Activity_service $Activity_service
 * @property League_service $League_service
 * @property League_model $League_model
 * @property Medal_service $Medal_service
 * @property Medal_model $Medal_model
 * @property Job $Job
 * @property Job_model $Job_model
 * @property Jwt_service $Jwt_service
 * @property Prop_service $Prop_service
 * @property Logs
 */

class Base_Controller extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->library('form_validation');
        $this->load->helper(array('form', 'url','common_helper'));
    }

    /*
    * 参数验证
    */
    public function validate($data, $rules)
    {
        $this->form_validation->set_data($data);
        $this->form_validation->set_rules($rules);
        if (!$this->form_validation->run()) {
            $msg = $this->form_validation->error_array();
            $msg = current($msg);
            return $msg;
        }
        return true;
    }
}